<!DOCTYPE html>
<html>
<head>
	<title>餐饮营销支持系统</title>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link href="../../css/bootstrap.min.css" rel="stylesheet">
	<!-- <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> -->
	<link rel="stylesheet" type="text/css" href="../../css/waiter.css">
	<link rel="stylesheet" type="text/css" href="../../css/manager.css">
</head>
<body>
	<div id="head">
		<div class="navbar navbar-default  navbar-inverse" role="navigation">
			<div class="navbar-header">
				<a href="##" class="navbar-brand">餐饮营销支持系统</a>
			</div>
			<button type="submit" class="btn btn-danger">
				<span style="margin-right: 5px" class="glyphicon glyphicon-off"></span>注销
			</button>
		</div>
	</div>
	
	<div id="left">

		<p class="left-head">
			经理登录</p>
			<div class="container">
				<div class="row" style="margin-top: 0px">
					<a href="./manager.html">
						<div class="col-md-12">
							<span class="glyphicon glyphicon-user"></span>
							<p>个人信息</p>
						</div>
					</a>
				</div>
				<div class="row">
					<a href="./manager-two.html">
						<div class="col-md-12">
							<span class="glyphicon glyphicon-th"></span>
							<p>收入查询</p>
						</div>
					</a>
				</div>
				<div class="row act">
					<div class="col-md-12">
						<span class="glyphicon glyphicon-asterisk"></span>
						<p>服务员管理</p>
					</div>

				</div>
				<div class="row">
					<div class="col-md-12"></div>
				</div>
			</div>
		</div>

		<div id="right">
			<div class="right-head">
				<ol class="breadcrumb">
					<li><a href="#">首页</a></li>
					<li class="active">服务人员详情</li>
				</ol> 
			</div>
			<div class="con">
				<div class="container">
					<div class="row">
						<div class="col-md-12">
							<div class="panel panel-default">
								<div class="panel-body">
									
									<div class="row pan-head">

										<p>
											服务人员详情
										</p>
										<div class="pan-headB">
											<button type="submit" class="btn btn-primary" id="three-add">
												<span style="margin-right: 5px" class="glyphicon glyphicon-signal"></span>添加
											</button>
										</div>
									</div>

									<div class="row">
										<div class="col-lg-10 col-lg-offset-1">
											<div class="table-responsive">
												<table class="table table-striped table-bordered table-hover">
													<thead>
														<tr>
															<th>名称</th>
															<th>手机号</th>
															<th>身份证号</th>
															<th>店铺</th>
															<th>删除</th>
														</tr>
													</thead>
													<tbody id = "waiters">
													</tbody>
												</table>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<script src="../../js/Jquary/jquery-3.2.1.min.js"></script>
		<script src="../../js/Jquary/jquery.easyui.min.js"></script>
		<script src="../../js/bootstrap.min.js"></script> 
		<script type="text/javascript" src="../../js/logout.js"></script>
		<script type="text/javascript">
			$(document).ready(function(){
				$("#three-add").click(function(){
					window.location.assign("./add-waiter.html")
				})
				$("#waiters").on('click', '.waiter',function(){
					var did = $(this).attr("name");
					var r=confirm("你确定要删除！");
					if (r==true){	
						delteWaiter(did);
					}
				});
				
				getAllWaiter()
				
			});
		</script>
		<script type="text/javascript">
			function delteWaiter(did){
				$.ajax({
					type:"get",
					url:"/ldss/user/remove",
					async:false,
					data:{
							userid:did
						},
					dataType:"json",
					success: function (data) {
						if(data.success){
							var data = data;
							alert(data.message);
							getAllWaiter();
						}else{
							alert(data.message);
						}
					}
				});
			}
			function getAllWaiter(){
				$.ajax({
					type:"get",
					url:"/ldss/store/allwaiter",
					dataType:"json",
					success: function (data) {
						if(data.success){
							var data = data.data;
							$("#waiters").empty();
							for(var i = 0; i < data.length; i++){
								$("#waiters").append(
									"<tr>"+
									"<td>"+data[i].username+"</td>"+
									"<td>"+data[i].usertel+"</td>"+
									"<td>"+data[i].userIDcard+"</td>"+
									"<td>"+data[i].storename+"</td>"+
									"<td>"+ 
									"<button type='button' class='btn btn-danger waiter' name='"+data[i].id+"'>"+"删 除"+"</button>"+
									"</td>"+
									"</tr>"
									);
							}
						}
						else{
							alert(data.message);
						}
					}
				})
			}
		</script>
	</body>
	</html>